home *** CD-ROM | disk | FTP | other *** search
- Path: homer17.u.washington.edu!sisca
- From: Fransisca Soerjono <sisca@u.washington.edu>
- Newsgroups: comp.lang.c++
- Subject: Help!
- Date: Thu, 29 Feb 1996 15:20:25 -0800
- Organization: University of Washington
- Message-ID: <Pine.A32.3.91j.960229151651.77675C-100000@homer17.u.washington.edu>
- NNTP-Posting-Host: homer17.u.washington.edu
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- NNTP-Posting-User: sisca
-
- Anyone knows how to write a program to convert positive
- numbers from decimal to binary.
-
- The program should repeatedly prompt the user to enter a number in
- decimal, then output the binary representation of the input. If the
- input is -1, the program should exit, and if the input is any other
- negative number the program should print a warning but then continue
- to solicit input.
-
- For example, a transcript might look like this:
-
- Enter a decimal number (-1 to quit): 5
- 101
- Enter a decimal number (-1 to quit): -3
- Invalid input
- Enter a decimal number (-1 to quit): 13
- 1101
- Enter a decimal number (-1 to quit): -1
- prompt%
-
- I'm using gcc by the way!
-
- Thanks! :)
-